import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns : BasicColumn[] = [
	{
		title: '商户ID',
		align: "center",
		dataIndex: 'shopid_dictText'
	},
	{
		title: '类型',
		align: "center",
		dataIndex: 'type_dictText'
	},
	{
		title: '楼层',
		align: "center",
		dataIndex: 'floor'
	},
	{
		title: '房间号',
		align: "center",
		dataIndex: 'roomnum'
	},
	{
		title: '每日单价(分)',
		align: "center",
		sorter: true,
		dataIndex: 'price'
	},
	/* {
	  title: '其他',
	  align:"center",
	  dataIndex: 'extinfors'
	 }, */
];
//查询数据
export const searchFormSchema : FormSchema[] = [
	{
		label: "类型",
		field: 'type',
		component: 'JDictSelectTag',
		componentProps: {
			dictCode: "basiclayout_hotelroominfor_type"
		},
		//colProps: {span: 6},
	},
];
//表单数据
export const formSchema : FormSchema[] = [
	{
		label: '商户ID',
		field: 'shopid',
		component: 'JSearchSelect',
		componentProps: {
			dict: "BS_BasicLayout_Shop,shopTitle,id"
		},
		dynamicRules: ({ model, schema }) => {
			return [
				{ required: true, message: '请输入商户ID!' },
			];
		},
	},
	{
		label: '类型',
		field: 'type',
		component: 'JDictSelectTag',
		componentProps: {
			dictCode: "basiclayout_hotelroominfor_type"
		},
		dynamicRules: ({ model, schema }) => {
			return [
				{ required: true, message: '请选择类型。舒适、一般、豪华!' },
			];
		},
	},
	{
		label: '楼层',
		field: 'floor',
		component: 'InputNumber',
		dynamicRules: ({ model, schema }) => {
			return [
				{ required: true, message: '请输入楼层!' },
				{ pattern: /^-?\d+$/, message: '请输入整数!' },
			];
		},
	},
	{
		label: '房间号',
		field: 'roomnum',
		component: 'Input',
		dynamicRules: ({ model, schema }) => {
			return [
				{ required: true, message: '请输入房间号!' },
			];
		},
	},
	{
		label: '每日单价，单位：分',
		field: 'price',
		component: 'InputNumber',
		dynamicRules: ({ model, schema }) => {
			return [
				{ required: true, message: '每日单价，单位：分!' },
				{ pattern: /^(([1-9][0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/, message: '请输入正确的金额!' },
			];
		},
	},
	{
		label: '其他',
		field: 'extinfors',
		component: 'Input',
		dynamicRules: ({ model, schema }) => {
			return [
				{ required: true, message: '请输入其他!' },
			];
		},
	},
	// TODO 主键隐藏字段，目前写死为ID
	{
		label: '',
		field: 'id',
		component: 'Input',
		show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData) : FormSchema[] {
	// 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
	return formSchema;
}